﻿using System;
using System.Linq;
using Blackthorn.Data.Repository;
using Demo.Data;
using Demo.Data.Model;
using Demo.LinqToSql.Data;

namespace Demo.ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            IDataRepository<ICustomer> customers = RepositoriesManager.Customers;

            foreach (var customer in customers)
            {
                Console.WriteLine("FirstName: " + customer.FirstName);
            }

            Console.ReadKey();

            var newCustomer = EntitiesFactory.CreateCustomer("Test2", "Test LastName");
            RepositoriesManager.Customers.Add(newCustomer);
            //RepositoriesManager.SaveChanges();

            Console.WriteLine("New customer added");

            customers = RepositoriesManager.Customers;

            foreach (var customer in customers)
            {
                Console.WriteLine("FirstName: " + customer.FirstName);
                RepositoriesManager.Customers.Delete(customer);
            }

            customers = RepositoriesManager.Customers;

            foreach (var customer in customers)
            {
                Console.WriteLine("FirstName: " + customer.FirstName);
            }
            Console.ReadKey();
        }
    }
}
